//
//  RegisterViewController.m
//  VTravel
//
//  Created by lanouhn on 16/8/1.
//  Copyright © 2016年 xiaoYu. All rights reserved.
//

#import "RegisterViewController.h"
#import "MineViewController.h"

@interface RegisterViewController ()

@end

@implementation RegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    // 手机号
    UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
    imageView1.image = [UIImage imageNamed:@"登录注册手机号"];
    self.registerPhoneNumberTextField.leftView = imageView1;
    self.registerPhoneNumberTextField.leftViewMode = UITextFieldViewModeAlways;
    
    // 验证码
    UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
    imageView2.image = [UIImage imageNamed:@"登录注册手机号验证"];
    self.SecurityTextField.leftView = imageView2;
    self.SecurityTextField.leftViewMode = UITextFieldViewModeAlways;
    
    UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    button.frame = CGRectMake(0, 0, 110, 30);
    [button setBackgroundImage:[UIImage imageNamed:@"登录注册发送验证码"] forState:(UIControlStateNormal)];
    [button setTitle:@"发送验证码" forState:(UIControlStateNormal)];
    button.titleLabel.font = [UIFont systemFontOfSize:12];
    [button setTitleColor:[UIColor orangeColor] forState:(UIControlStateNormal)];
    [button addTarget:self action:@selector(handleSendSecurity) forControlEvents:(UIControlEventTouchUpInside)];
    self.SecurityTextField.rightView = button;
    self.SecurityTextField.rightViewMode = UITextFieldViewModeAlways;
    
    // 密码
    UIImageView *imageView3 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
    imageView3.image = [UIImage imageNamed:@"登录注册密码"];
    self.passWordTextField.leftView = imageView3;
    self.passWordTextField.leftViewMode = UITextFieldViewModeAlways;
    
    // 配置导航栏
    self.navigationItem.title = @"手机号注册";
    
    UIBarButtonItem *rigthItem = [[UIBarButtonItem alloc] initWithTitle:@"返回登录" style:(UIBarButtonItemStyleDone) target:self action:@selector(handleRegister)];
    self.navigationItem.rightBarButtonItem = rigthItem;

    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"登录注册返回键"] style:(UIBarButtonItemStyleDone) target:self action:@selector(handleMineController)] ;
    self.navigationItem.leftBarButtonItem = leftItem;
}

/** 返回登录 */
- (void)handleRegister{
    [self.navigationController popViewControllerAnimated:YES];
}
/** 返回我的界面 */
- (void)handleMineController{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

/** 向手机发送验证码 */
- (void)handleSendSecurity{
    kMyLog(@"向手机发送验证码");
}

/** 注册并登录按钮点击事件 */
- (IBAction)HandleRegisterAndeLoginAction:(UIButton *)sender {
    kMyLog(@"点击了注册并登录按钮");
}

@end
